<template>
  <div class="keji">
    <my-swiper :focusList="focusList" v-if="focusList.length"></my-swiper>
    <!-- nav部分 -->
    <nav-bar :tomatoes="tomatoes"></nav-bar>
    <!-- 下载app的banner图片 -->
    <download-img></download-img>
    <!-- 主要内容 -->
    <xy-content
      v-for="(item, index) in content_xy"
      :key="index"
      :infoList="item.albumBriefDetailInfos"
      :moduleInfo="item.moduleInfo"
    ></xy-content>

    <my-footer></my-footer>

    <my-load v-if="isShow"></my-load>
  </div>
</template>

<script>
import { initHomeIndexData } from "@/request/api.js";

export default {
  name: "MyKeji",
  data() {
    return {
      tomatoes: [],
      content_xy: [],
      comlist: [],
      focusList: [],
      isShow: false,
    };
  },
  components: {},
  created() {
    this.initData();
  },
  methods: {
    initData() {
      let flag = localStorage.getItem("flag");
      if (flag) {
        this.isShow = flag;
      }
      initHomeIndexData("keji")
        .then((res) => {
          let module = res.data.data.moduleContent;
          this.tomatoes = module.tomatoes;
          let list = module.moduleRankDatas;
          this.content_xy = list;
          module.focusImages.forEach((item) => {
            let obj = {
              img: item.adFocusPictureDetail.cover,
            };

            this.focusList.push(obj);
          });

          if(this.tomatoes.length > 0){
            this.isShow = false
            localStorage.setItem('flag',this.isShow)
          }
          console.log("音乐页面:", res.data);
        })
        .catch((err) => {
          console.log("获取数据失败");
        });
    },
  },
};
</script>

<style lang="scss" scoped>
</style>

